package operate;
import book.Book;
import book.BookList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 05 - 10
 * Time: 20:18
 */
public class AddOperate implements IOperation{
    @Override
    public void work(BookList bookList) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("输入要增加的书的书名");
            String name = scanner.nextLine();
            System.out.println("输入要增加的书的作者");
            String autor = scanner.nextLine();
            System.out.println("输入要增加的书的价格");
            int price = scanner.nextInt();
            scanner.nextLine();
            System.out.println("输入要增加的书的类型");
            String type = scanner.nextLine();
            int currentNums = bookList.getBooknumbers();
            Book book = new Book(name, autor, price, type);
            bookList.setBook(currentNums, book);
            bookList.setBooknumbers(currentNums + 1);
            System.out.println("新增图书成功");
    }
}
